#ifndef CANNON_BALL_H
#define CANNON_BALL_H

#include "ActorEntity.h"
#include "../../WrappedContainers/LinkedList.h"
#include "../../WrappedContainers/ArrayList.h"
#include "../../SurfaceRenderingData.h"
#include "../../Player.h"
#include "../../Util/Physx.h"

class CannonBall : public ActorEntity {
protected:
	NxActor* actor;
	LinkedList<NxMat34> tailPositions;
	static SurfaceRenderingData srd;
	bool explosive;
	NxVec3 windForce;
	Player* owner;

	static const float radius;
	static unsigned int displayList;

public:
	static ArrayList<CannonBall*> all;
	static LinkedList<CannonBall*> toDelete;

public:
	static void Load();
	static void DeleteDestroyed();

	CannonBall(Player* owner, const NxVec3& pos, const NxVec3& initialVelocity, const NxVec3& windForce, bool explosive);
	virtual ~CannonBall();

	virtual void Draw();
	virtual void Tick();

	virtual inline ACTOR_ENTITY_TYPE GetType() const { return AET_CANNON_BALL; }

	inline NxActor* GetActor() const { return actor; }

	inline Player* GetOwner() const { return owner; }
	inline void SetOwner(Player* owner) { this->owner = owner; }

	inline bool IsExplosive() const { return explosive; }

	inline void SetWind(const NxVec3& windForce) { this->windForce = windForce; }

	static inline int GetExplosionCosts() { return 200; }
};

#endif //CANNON_BALL_H
